package letcode2090

func GetAverages(nums []int, k int) (arr []int) {
	arr = make([]int, len(nums))
	if k == 0 {
		return nums
	}
	for i := range nums {
		arr[i] = -1
	}

	tmp := 0
	for right, value := range nums {
		tmp += value
		if right < 2*k {
			continue
		}

		arr[right-k] = tmp / (2*k + 1)
		out := right - 2*k
		tmp -= nums[out]

	}

	return
}
